import 'package:boss/provider/table_provider.dart';
import 'package:boss/ui/page/tableManagement/page/sortTable/provider/sort_table_provider.dart';
import 'package:boss/ui/widget/form/select_form_field.dart';
import 'package:hi_common/hi_common.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

class SortTableHeader extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: EdgeInsets.symmetric(
        horizontal: 30.w,
      ),
      child: Consumer2<TableProvider, SortTableProvider>(
        builder: (context, tableProvider, sortTableProvider, _) {
          return SelectFormField(
            title: '区域',
            items: tableProvider.storeAreas
                .map((item) => SelectItem(title: item.areaName, value: item))
                .toList(),
            value: sortTableProvider.selectedArea,
            onChanged: (value) {
              sortTableProvider.setArea(value);
            },
          );
        },
      ),
    );
  }
}
